package com.lagou.order;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients//该注解支持熔断功能
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class,args);
    }

    /**
     * 向容器中注入一个RestTemplate，封装了HttpClient
     * 页面静态化微服务调用的是商品微服务 所以不需要有service,mapper层 直接调用即可
     * @return
     */
    @Bean
    @LoadBalanced //启动请求的负载均衡(Ribbon)
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
